#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> arr(n + 1);

    for (int i = 1; i <= n; i++)
        cin >> arr[i];

    int ret = 1, pos = 1;
    for (int i = 2; i <= n; i++) {

        if (arr[i] - arr[i - 1] <= 8)
            continue;
        
        ret = max(ret, i - pos);
        pos = i;
    }
    ret=max(n-pos+1,ret);
    cout << ret << endl;
    return 0;
}
